package com.qing.demo.netty.demo1.bio.server;

import cn.hutool.log.Log;
import com.qing.demo.netty.demo1.bio.ChannelAdapter;
import com.qing.demo.netty.demo1.bio.ChannelHandler;
import lombok.extern.slf4j.Slf4j;

import java.net.Socket;
import java.nio.charset.Charset;
import java.util.logging.Logger;

/**
 * @author caozhipeng
 * @date 2025/7/22
 */

public class BioServerHandler extends ChannelAdapter {


    public BioServerHandler(Socket socket, Charset charset) {
        super(socket, charset);
    }



    @Override
    public void channelRead(ChannelHandler channelHandler, String str) {
        logger.info("服务端接收信息 ："+str);
        channelHandler.writeAndFlush("服务端信息处理success \r\n");
    }

    @Override
    public void channelActive(ChannelHandler channelHandler) {
        logger.info("服务端连接成功! IP:"+channelHandler.socket().getLocalAddress());
        channelHandler.writeAndFlush("服务端连接成功! \r\n");
    }
}
